<template>
<div class="phonelogin">
  <div class="title">
    <p>

      <img src="../img/backtwo.png" alt="" @click="back">

      <span class="text">手机号登录</span>
    </p>

  </div>
  <div class="plogom">
    <div class="user">
      <input type="text" placeholder="手机号" v-model="userid" @click="numkey">
      <img src="../img/shouji.png" alt="">
    </div>
    <div class="password">
      <input type="password" placeholder="密码" v-model="pwd">
      <img src="../img/mima.png" alt="">
    </div>
    <div class="loginbtn" @click="loginbtn">
      登录
    </div>
    <p class="resetpassword">重置密码</p>
  </div>
  <otherlogin></otherlogin>
  <van-number-keyboard
    v-model="userid"
    :show="show"
    extra-key="."
    close-button-text="完成"
    @blur="show = false"


  />
</div>
</template>

<script>
  import otherlogin from '../components/login/otherlogin'
    export default {
        name: "phonelogin",
      components:{otherlogin},
      data(){
        return{
          userid:'',
          pwd:'',
          show:false,
        }
      },
      methods:{
        back(){
            this.$router.push({path:'/login'})
          },
        loginbtn(){

          this.$http.get(`/api/login/cellphone?phone=${this.userid}&password=${this.pwd}`)
              .then((res)=>{
                this.$storage.set('user',res.data);
                  this.$toast('登陆成功');
                  this.$router.push({path:'/index'});

              })
              .catch((err)=>{
                this.$toast('用户名或密码错误,请重新输入');
                this.userid='';
                this.pwd='';
              })
        },
        numkey(){
          this.show=true;
        }
      }
    }
</script>

<style lang="scss">
*{
  margin: 0px;
  padding: 0px;
}
  .phonelogin{
    width: 1245px;
    .title{
      height: 190px;
      position: relative;
      background-color: #c54a3d;
      p{
        width: 100%;

        padding-top: 50px;
        box-sizing: border-box;
        img{
          position: absolute;
          bottom: 33px;
            width: 70px;
            object-fit: cover;

          }
        .text{
          position: absolute;
          display: inline-block;
          color: white;
          font-weight: bold;
          font-size: 50px;
          left: 50%;
          bottom: 40px;
          transform: translateX(-50%);

        }
      }
    }
    .plogom{
      padding: 0 50px;
      box-sizing: border-box;
      .user,.password{
        position: relative;
        input{
          width: 100%;
          border: none;
          box-sizing: border-box;
          padding: 40px 0;
          color: #bcbdbe;
          font-size: 50px;
          text-indent: 95px;
          border-bottom: 2px solid #ccc;
        }
        img{
          width:60px;
          top: 50%;
          left: 12px;
          transform: translateY(-50%);
          position: absolute;
          object-fit: cover;
        }
      }
      .loginbtn{
        margin-top: 90px;
        background-color: #d65244;
        font-weight: bold;
        font-size: 45px;
        text-align: center;
        color: #d96355;
        line-height: 120px;
        border-radius: 60px;
      }
      .resetpassword{
        width: 167px;
        margin:0 auto;
        text-align: center;
        padding: 80px 0 10px 0;
        color: #787778;
        font-weight: bold;
        border-bottom: 5px solid #787778;
        font-size: 40px;
      }
    }
  }
</style>
